import {http} from "@/service/http";


/**
 * 通过用户名和密码方式获取token
 * @param name name
 * @param pass pass
 */
export const getToken = (name: string, pass: string) => {
  
  return http({
    method: 'GET',
    url: '/Login/MinecraftPlayerLogin',
    params: {
      name, pass
    }
  })
}


/**
 * 获取 JWT 的方法 nuxt 提供 (不用)
 * @param name name
 * @param pass pass
 */
export const getTokenNuxt = (name: string, pass: string) => {
  return http({
    method: 'GET',
    url: '/Login/GetTokenNuxt',
    params: {
      name, pass
    }
  })
}


/**
 * 获取 JWT 的方法  jsonp 提供
 * @param callback
 * @param id
 * @param sub
 * @param expiresSliding
 * @param expiresAbsoulute
 */
export const getTokenJsonp = (callback: any, id: number, sub: string, expiresSliding: string, expiresAbsoulute: number) => {
  return http({
    method: 'GET',
    url: '/Login/jsonp',
    params: {
      callback, id, sub, expiresSliding, expiresAbsoulute
    }
  })
}


/**
 * 获取系统主要方法
 * @param name name
 * @param pass pass
 */
export const getTokenJwt = (name: string, pass: string) => {
  return http({
    method: 'GET',
    url: '/Login/JWTToken3.0',
    params: {
      name, pass
    }
  })
}

/**
 * 测试md5加密字符串
 * @param password @param pass pass
 */
export const getMd5Pass = (password: string) => {
  return http({
    method: 'GET',
    url: '/Login/Md5Password',
    params: {
      password
    }
  })
}


/**
 * 刷新token
 * @param token 当前token
 */
export const refreshToken = (token: string) => {
  return http({
    method: 'GET',
    url: '/Login/Md5Password',
    params: {
      token
    }
  })
}


/**
 * 微信登录
 * @param g g
 * @param token 当前token
 */
export const getWeChatLogin = (g: string, token: string) => {
  return http({
    method: 'GET',
    url: '/Login/wxLogin',
    params: {
      g, token
    }
  })
}
